package com.itheima.zhuangbi;

import com.itheima.domain.Student;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/*
越过私有
 */
public class Demo02 {

    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {

        //Student student = new Student();
        Class<Student> clazz = Student.class;
        //student.sing();
        //Class<? extends Student> clazz = student.getClass();
        Method sing = clazz.getDeclaredMethod("sing");
        sing.setAccessible(true);
        sing.invoke(clazz.newInstance());


    }
}
